<template>
  <div id="tab-bar">
    <van-tabbar v-model="active" active-color="red"
    @change="tabChange"
    >
      <van-tabbar-item icon="wap-home">首页</van-tabbar-item>
      <van-tabbar-item icon="apps-o">分类</van-tabbar-item>
      <van-tabbar-item icon="shopping-cart">购物车</van-tabbar-item>
      <van-tabbar-item icon="contact">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import Vue from 'vue';
import { Tabbar, TabbarItem } from 'vant';
import 'vant/lib/tabbar/style'
import 'vant/lib/tabbar-item/style'
Vue.use(Tabbar);
Vue.use(TabbarItem);

export default {
  name:"TabBar",
  data() {
    return {
      active:0
    }
  },
  methods: {
    tabChange(i){
      // console.log(i);
      this.$emit("changeIndex",i)
    }
  },
}
</script>

<style scoped>

</style>